<template>
  <div id="container">
    <h1>{{ initInfo }}</h1>
    <h2 id="h2"></h2>
    <div class="box">你的名字32232reswr</div>
    <img src="./assets/style/photo.jpeg" alt="" />
    <button @click="choose">点击32</button>
  </div>
</template>
<script>
export default {
  name: "App",
  data() {
    return {
      initInfo: "lakeiedward",
      arr: [
        { name: "Jerry" },
        undefined,
        { name: "Jerry" },
        [1, 2, 3],
        undefined,
        [1, 2, 3],
        null,
        NaN,
      ],
      infp: "",
    };
  },
  props: [],
  async mounted() {
    console.log(process.env);
    // this.arr = await this.fn(this.arr);
    // this.infp = Object.fromEntries(this.arr);
    // h2.innerText = Window.serve.BASE_URL;
  },
  methods: {
    fn(arr) {
      return new Promise((res) => {
        if (res) {
          res(this.unique(arr));
        }
      });
    },

    choose() {
      this.unique(this.arr);
    },

    unique(arr) {
      arr = arr.filter((r) => r);
      let map = new Map();
      let arrCopy = [];
      arr.forEach((r) => {
        let re = JSON.stringify(r);
        if (!map.has(re)) {
          map.set(re, true);
          arrCopy.push(r);
        }
      });
      return arrCopy;
    },
  },
};
</script>
<style scoped lang="less">
@import "./assets/css/index.less";
h1 {
  color: var(--light-color);
}
</style>
